# coding=utf-8

from django.contrib import admin

from .models import Pool
from .models import Agent
from .models import AgentHeartbeat


@admin.register(Pool)
class PoolAdmin(admin.ModelAdmin):
    """ """
    list_display = ("id", "name", "pid", "pool_user_id", "create_time", "update_time")


@admin.register(Agent)
class AgentAdmin(admin.ModelAdmin):
    list_display = ("id", "idc", "ip", "cpu", "alias", "local_its", "local_avg_its",
                    "status", "project_id", "server_id", "az",
                    "last_active", "create_time", "update_time")

    search_fields = ("alias", "ip")

    list_filter = ("status", "idc")


@admin.register(AgentHeartbeat)
class AgentHeartbeatAdmin(admin.ModelAdmin):
    list_display = ("id", "alias", "ip", "local_its", "local_avg_its", "cur_time", "create_time", "update_time")

    search_fields = ("alias", "ip")

